package com.qidian.mes.qc.controller;/**
 * ClassName:MaterialProductController
 * Package:com.qidian.mes.qc.controller
 **/

import com.qidian.mes.pojo.MaterialProduct;
import com.qidian.mes.qc.service.MaterialProductService;
import com.qidian.mes.util.dot.PagerDTO;
import com.qidian.mes.util.pojo.QdResult;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author ppc
 * @Conpany study
 * @Description:
 * @Time 2024/4/13 9:49
 *
 **/
@CrossOrigin
@RestController
@RequestMapping("/product")
public class MaterialProductController {
    @Autowired
    private MaterialProductService materialProductService;

    @RequestMapping("/query")
    public QdResult<PagerDTO<MaterialProduct>> query(String templateId, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer limit) {
        return materialProductService.queryAllByPage(templateId, page, limit);
    }
    @RequestMapping("/queryAll")
    public QdResult<MaterialProduct> queryAll() {
        return materialProductService.queryAll();
    }

    @RequestMapping("/queryById")
    public QdResult<MaterialProduct> queryById(String materialProductId) {
        return materialProductService.queryById(materialProductId);
    }

    @RequestMapping("/update")
    public QdResult insert(@RequestBody MaterialProduct materialProduct) {
        return materialProductService.update(materialProduct);
    }

    @RequestMapping("/save")
    public QdResult save(@RequestBody MaterialProduct materialProduct) {
        return materialProductService.insert(materialProduct);
    }

    @RequestMapping("/delete")
    public QdResult delete(String materialProductId) {
        return materialProductService.delete(materialProductId);
    }

    @RequestMapping("/deletes")
    public QdResult deletes(String[] materialProductIds) {
        return materialProductService.deletes(materialProductIds);
    }



}
